<?php
/**
 * 后台管理中心基类
 */
class AdminAction extends Action {
	
	public function _initialize() {
		
		import ( "ORG.Util.Session" );
		
		// 是否登陆
		if (is_null ( Session::get ( "admin_uid" ) )) {
			$this->error ( '未登陆，请重新登陆!', '/Public/login/' );
		} else {
			
			// 登陆用户查询
			$Admin = D ( "Admin" );
			$AdminInfo = $Admin->find ( Session::get ( "admin_uid" ) );
			
			if ($AdminInfo) {
				// 用户所属角色
				$AdminRole = D ( "AdminRole" );
				$AdminRoleInfo = $AdminRole->find ( $AdminInfo ['roleid'] );
				$AdminInfo ['rolename'] = $AdminRoleInfo ['rolename'];
			}
			$AdminInfo ['lastlogintime'] = date ( "Y-m-d H:i:s", $AdminInfo ['lastlogintime'] );
			$this->assign ( "AdminInfo", $AdminInfo );
			
			// 顶部导航菜单
			$admin_menu = $Admin->admin_menu ( 0 );
			$this->assign ( "admin_menu", $admin_menu );
			
			// 当前操作模块的名称
			$Module_name = MODULE_NAME;
			
			// 当前操作动做名称
			$Action_name = ACTION_NAME;
			
			// 记录操作日志
			
			// 是否锁屏
			if (is_null ( Session::get ( "lock_screen" ) ) || Session::get ( "lock_screen" ) == 0) {
				$this->assign ( "lock_screen", 0 );
			} else {
				$this->assign ( "lock_screen", 1 );
			}
		}
	}
}
?>